package com.jzrh.flashbee.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Jince
 * @since: 2023.11.23 上午 12:32
 * @description:
 */
@Controller
@Slf4j
public class IndexController {

    @RequestMapping("/")
    public String index(HttpServletRequest request){
        if(request.getSession().getAttribute(request.getRemoteAddr())!=null){
            log.info(request.getSession().getAttribute(request.getRemoteAddr()).toString());
            return "index";
        }
        return "login";
    }

    @RequestMapping("/access")
    public String api(HttpServletRequest request){
        if(request.getSession().getAttribute(request.getRemoteAddr())!=null){
            log.info(request.getSession().getAttribute(request.getRemoteAddr()).toString());
            return "access";
        }
        return "login";
    }
    @RequestMapping("/api")
    public String doc(HttpServletRequest request){
        if(request.getSession().getAttribute(request.getRemoteAddr())!=null){
            log.info(request.getSession().getAttribute(request.getRemoteAddr()).toString());
            return "api";
        }
        return "login";
    }
}
